const nodata = require('../tw-lib-base/no-data/props')
const commonProps = require('../tw-lib-base/chart/common-props')
const axisProps = require('../tw-lib-base/chart/axis-props')
const datazoomProps = require('../tw-lib-base/chart/datazoom-props')
const tooltipProps = require('../tw-lib-base/chart/tooltip-props')

module.exports = {
  ...commonProps,

  ...axisProps,
  ...datazoomProps,
  ...tooltipProps,

  data: {
    type: Array,
    default () {
      return [
        ['姓名', '张思睿', '李福娥', '王飞虎'],
        ['语文', 43.3, 85.8, -93.7],
        ['数学', 83.1, 73.4, 55.1],
        ['英语', 86.4, 65.2, 82.5],
        ['物理', 84.4, 80, 85]
      ]
    },
    name: '图表数据集',
    filedType: 'api'
  },

  barMaxWidth: {
    type: String,
    default: '50%',
    name: '柱子最大宽度',
    filedType: 'string'
  },
  useSeries: {
    type: Boolean,
    default: false,
    name: '启用定制series',
    filedType: 'switch'
  },
  funcSeries: {
    type: Function,
    default: '',
    name: '定制series函数',
    filedType: 'function'
  },
  axisLineType: {
    type: String,
    default: 'solid',
    name: 'X坐标轴线类型',
    filedType: 'select',
    options: [
      {
        name: 'solid',
        value: 'solid'
      },
      {
        name: 'dashed',
        value: 'dashed'
      },
      {
        name: 'dotted',
        value: 'dotted'
      }
    ],
    // 是否支持多选，支持多选时default要指定为数组
    multiple: false
  },
  axisXLineColor: {
    type: String,
    default: '#d1d1d9',
    name: 'X轴线颜色',
    filedType: 'color'
  },
  useYAxisFun: {
    type: Boolean,
    default: false,
    name: '启用Y坐标刻度函数',
    filedType: 'switch'
  },
  funcYAxisLabel: {
    type: Function,
    default: 'function tmpaxisfunc (value) {let index = -1; if (value.length > 6) {index = 6;}let text = value;if (index > 0) { text = `${text.slice(0, 6)}\n${text.slice(6)}`;} return text;}',
    name: 'Y坐标刻度函数',
    filedType: 'function'
  },
  custAvg: {
    type: Boolean,
    default: false,
    name: '开启平均值为X轴',
    filedType: 'switch'
  },
  avgFixed: {
    type: String,
    default: '0',
    name: '平均值小数位数',
    filedType: 'string'
  },
  extendOption: {
    type: Boolean,
    default: false,
    name: '扩展定制option',
    filedType: 'switch'
  },
  funcExtOption: {
    type: Function,
    default: '',
    name: '扩展定制option函数',
    filedType: 'function'
  },

  ...nodata
}
